<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS计算器</title>
    <script >
        function calc() {
            var input01 = prompt("请输入第一个操作数：", "7");
            var oper = prompt("请输入操作符：(仅支持：+ - * /)", "+");
            var input02 = prompt("请输入第二个操作数：", "3");
            var rst;
            num01 = parseFloat(input01);
            num02 = parseFloat(input02);

            switch (oper) {

                case"+":
                    rst = num01 + num02;
                    break;
                case"-":
                    rst = num01 - num02;
                    break;
                case"*":
                    rst = num01 * num02;
                    break;
                case"/":
                    rst = num01 / num02;
                    break;
                default:
                    rst = "你大爷的，计算器都不会用吗，啊！！！";
                    break;
            }
            alert("运算结果为：" + rst);
        }
    </script>
</head>
<body>
     <div align="center">
         <input name="cale" type="button" value="JS计算器" onclick="calc();" />
     </div>
</body>
</html>